<%@page import="com.skeleton.db.dto.ShowinfoDto"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>项目进度展示</title>
	<script type="text/javascript" src="<%=request.getContextPath() %>/resource/jquery-1.8.2.js"></script>
	<style type="text/css">
		body {
			margin: 0px;
			padding: 0px;
			font-family: 微软雅黑;
		}
		
		.fl {
			float: left;
		}
		
		.fr {
			float: right;
		}
		
		.cb {
			clear: both;
		}
		
		.main {
			font-size: 24px;
			text-align: center;
		}
		
		.sub {
			font-size: 20px;
			margin: 20px 0px;
		}
		
		.item1 {
			background-color: #f8f8f8;
			margin-left: 30px; 
		}
		
		.item2 {
			border-bottom-color: white;
			margin-left: 30px; 
		}
		
		.item {
			font-size: 14px;
			margin: 5px 0 5px 10px;
		}
		
		.icon {
			width: 30px;
		}
		
		.title {
			width: 240px;
		}
		
		.time {
			width: 140px;
		}
		
		.people {
			width: 190px;
		}
		
		.commnet {
			width: 320px;
		} 
		
	</style>
	<script type="text/javascript">
		$(function() {
			showTime();
		});
		
		function showTime() {
			var htmlStr = "";
			var date = new Date();
			htmlStr += date.getFullYear() + "年" + (date.getMonth() + 1) + "月" + date.getDate() + "日";
			htmlStr += " " + (date.getHours() < 10 ? "0" + date.getHours() : date.getHours());
			htmlStr += ":" + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes());
			htmlStr += ":" + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds());
			$('#showTimeDiv').html(htmlStr);
		}
		setInterval(showTime, 1000);
	</script> 
</head>
<body>
	<div style="margin: 20px;">
		<div style="font-size: 30px; font-weight: bold;" class="fl">工程进度展示</div>
		<div class="fl">
			<a href="<%=request.getContextPath() %>/login" style="color: white;">后台登录</a> 
		</div>
		<div class="fr" id="showTimeDiv" style="font-size: 20px; margin: 5px 50px;"></div> 
		<div class="cb"></div>
	</div>
	<hr /> 
	<div style="width: 100%; height: 100%;"> 
		<div style="margin: 0 auto; width: 1000px;">
			<%
				List<ShowinfoDto> list = (List<ShowinfoDto>)request.getAttribute("list");
				if(list != null) {
					for(int i=0; i<list.size(); i++) {
						ShowinfoDto dto = list.get(i);
						if(dto.getShowId().length() == 3) {
			%>
					<div class="main"><%=dto.getShowTitle() %></div>
					<div>
						<%
							for(int j=0; j<list.size(); j++) {
								ShowinfoDto dto2 = list.get(j);
								if(dto2.getShowId().length() == 6 && dto2.getShowId().substring(0, 3).equals(dto.getShowId())) {
						%>
						<div class="sub"><%=dto2.getShowTitle() %></div>
						<div>
								<%
									int nn = 0;
									for(int k=0; k<list.size(); k++) {
										ShowinfoDto dto3 = list.get(k);
										if(dto3.getShowId().length() == 9 && dto3.getShowId().substring(0, 6).equals(dto2.getShowId())) {
											nn++;
											if(nn%2 == 0) {
								%>
								<div class="item2">
								<%
											} else {
								%>
								<div class="item1">
								<%
											}
								%>
									<div class="item fl icon">
										<%
											char status = dto3.getShowStatus();
											if (status == '1') {
										%>
												<img alt="" src="<%=request.getContextPath() %>/resource/checkmark.png" width="20" height="20">
										<%
											}
											if (status == '2') {
										%>
												<img alt="" src="<%=request.getContextPath() %>/resource/cross.png" width="20" height="20">
										<%
											}
										%>
									</div>
									<div class="item fl title"><%=dto3.getShowTitle() %></div>
									<div class="item fl people"><%=dto3.getShowPeople() %></div>
									<div class="item fl time">
									<%
										String time = dto3.getFinishDttmStr();
										if (time != null) {
											out.println(time);
										}
									%>
									</div>
									<div class="item fl commnet"><%=dto3.getShowCommnet() %></div>
									<div class="cb"></div>
								</div>
								<%
										}
									}
								%>
						</div>
						<%
								}
							}
						%>
					</div>
			<%
						}
					}
				}
			%>
		</div>
	</div>
</body>
</html>